package tea.lib{
	public class encode {
		public function encode() {
			// constructor code
		}

		static public function booleanArrayToByte(...arg):uint {
			var count:uint=0;
			for (var i:int=0,j:int=1; i<arg.length; i++,j*=2) {
				if (arg[i]) {
					count+=j;
				}
			}
			return count;
		}
		static public function byteToBooleanArray(num:uint,key:uint=8):Array {
			var returner:Array=[];
			for (var i:int=key-1; i>=0; i--) {
				returner[i]=(num>>i & 1)==1;
			}
			return returner;
		}
	}
}